classDiagram
    class RaftNode {
        -RaftState state
        -LogEntry[] logs
        -RaftMessageHandler messageHandler
        +startElection()
        +appendEntries()
        +handleVoteRequest()
        +handleAppendEntries()
    }
    
    class RaftState {
        <<enumeration>>
        FOLLOWER
        CANDIDATE
        LEADER
    }
    
    class LogEntry {
        -int term
        -int index
        -byte[] data
        +getTerm()
        +getIndex()
        +getData()
    }
    
    class RaftMessage {
        -int term
        -int leaderId
        -LogEntry[] entries
        +getTerm()
        +getLeaderId()
        +getEntries()
    }
    
    class RaftMessageHandler {
        <<interface>>
        +sendMessage()
        +receiveMessage()
    }
    
    class InMemoryMessageHandler {
        -Queue messageQueue
        +sendMessage()
        +receiveMessage()
    }
    
    RaftNode --> RaftState
    RaftNode --> LogEntry
    RaftNode --> RaftMessageHandler
    RaftMessageHandler <|.. InMemoryMessageHandler
    RaftNode ..> RaftMessage 